//
//  YLMineMoneyTableViewCell.m
//  YLFinanceService
//
//  Created by she1323 on 2017/9/15.
//  Copyright © 2017年 she1323. All rights reserved.
//

#import "YLMineMoneyTableViewCell.h"
#import "YLMineMoneyModel.h"

@interface YLMineMoneyTableViewCell()
@property (weak, nonatomic) IBOutlet UILabel *productNameLabel;

@property (weak, nonatomic) IBOutlet UILabel *moneyLabel;

@property (weak, nonatomic) IBOutlet UILabel *otherLabel;

@end

@implementation YLMineMoneyTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}


- (void)setModel:(YLMineMoneyModel *)model
{
    _model = model;
    
    _productNameLabel.text = model.productName;
    
    switch (model.type) {
        case YLMineMoneyModelTypeInvestment:
            _otherLabel.text = model.contractCode;
            _moneyLabel.text = [NSString stringWithFormat:@"%.2f", model.investmentAmount];
            break;
            
        case YLMineMoneyModelTypeExpectedEarnings:
            _otherLabel.text = model.contractCode;
            _moneyLabel.text = [NSString stringWithFormat:@"%.2f", model.expectIncome];
            break;
            
        case YLMineMoneyModelTypeIncomeToAccount:
            _moneyLabel.text = [NSString stringWithFormat:@"%.2f", model.incomeAmount];
            _otherLabel.text = model.paymentDateText;
            
        default:
            break;
    }
}

+ (NSString *)cellID
{
    return @"YLMineMoneyTableViewCell";
}

@end
